from django.apps import AppConfig

# accounts/apps.py

import threading
from accounts.utils import start_watchdog  # 假设你的监控脚本在 main 应用中

class AccountsConfig(AppConfig):
    name = 'accounts'
    print("AccountsConfig.ready() 被调用")
    def ready(self):
        # 在项目启动时启动文件监控
        path_to_watch = '/home/tkp666/simple-django-login-and-register/source/content/media/videos'
        thread = threading.Thread(target=start_watchdog, args=(path_to_watch,), daemon=True)
        thread.start()
